@extends('host.custom.common.common')

@section('c-head')
    <script type="text/javascript">
        var PAGE_DATA = {
            pagingObj : {
                total : 0,
                perpage : 7,
                page : 1
            },
            //采购商信息
            buyers:{
                id: {{ $authorization->purchaser->id }},//采购商id
                name:"{{ $authorization->company_name }}",	//采购商名称
                sqtime:"{{ date('Y-m-d', strtotime($authorization->created_at)) }}",  //申请时间
                sqmart:"{{ route('account.member.authorization-request.show', [$authorization->id]) }}"  //申请信息
            }
        };
    </script>
    <script type="text/javascript">

        $(function(){
            // $("#myform1").validate();
            $("#editor").click(function(){
                var d = dialog({
                    title: '筛选授权商品',
                    content: '<div class="dialog-div">商品名称：<input type="text" class="input"></div><div class="dialog-div">商品货号：<input type="text" class="input"></div><div class="shop-num-select dialog-div">商品分类：<select><option></option><option>1</option><option>2</option></select></div><div class="screen"><div class="btn btn-warn btn-w140x42">筛选</div></div>'
                });
                d.showModal();
            });
        })
    </script>
    <style type="text/css">label.error{margin-left: 18px;color: #FF500B;}</style>
@stop

@section('body')
    <style>
        .com-info .info-box{
            margin-top: 0px;
        }
    </style>
        <!-- top_test -->
    <div id="top_test"></div>

    <!-- web_logo_search -->
    <div id="web_logo_search"></div>

    <!-- comm_nav -->
    <div id="comm_nav"></div>

    <div class="com-w mt20">
        <div class="wrapper clearfix">
            <div  class="w220 mr20 comm-left-menu">
                <div class="menu-top-title">供应商中心</div>
                <div id="leftmenuitems"></div>
            </div>

            <div class="w960 comm-main">
                <div class="main-release clearfix">
                    <div class="main-release-nav">您当前的位置：首页 > 供应商中心</div>
                    <div class="main-release-title">
                        <span class="icons"></span>
                        <span class="release-title-h3 f16">我的采购商</span>
                    </div>
                    <div class="main-release-from">
                        <div id="commTabs_1" class="comm-tabs">
                            <div class="comm-tabs-head">
                                <div class="head-item current">商品授权</div>
                            </div>
                            <div class="comm-tabs-body">
                                <div class="body-item current">
                                    <div class="com-info clearfix">
                                        <div class="info-box clearfix">
                                            <span class="com-info-l">采购商名称：</span>
                                            <span class="com-info-r info-name" id="name"></span>
                                        </div>
                                        <div class="info-box clearfix">
                                            <span class="com-info-l">申请时间：</span>
                                            <span class="com-info-r" id="sqtime"></span>
                                        </div>
                                        <div class="info-box clearfix">
                                            <span class="com-info-l">申请信息：</span>
                                            <a href=""
                                               class="com-info-r"
                                               id="sqmart"
                                               style="line-height: 40px; color:#ff500b;">查看详情</a>
                                        </div>
                                        <div class="info-box clearfix">
                                            <span class="com-info-l">选择授权商品</span>
                                            <span class="com-info-r">
                                                <span class="btn btn-important btn-w100x32" id="add-warrant-shop">添加授权商品</span>
                                            </span>
                                        </div>
                                    </div>
                                    <!-- 已选的商品列表 -->
                                    <div class="add-empower clearfix" id="already">

                                    </div>
                                    <div class="clearfix warrant">
                                        <div class="select-box clearfix">
                                            <div class="select-b-l">
                                                选择价格策略：
                                            </div>
                                            <div class="select-b-r w238x30">
                                                <select id="price">
                                                    <option value="">请选择</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="select-box clearfix">
                                            <div class="select-b-l">
                                                选择授权范围：
                                            </div>
                                            <div class="select-b-r">
                                                <select id="province" name="province" >
                                                    <option value="">请选择</option>
                                                </select>
                                                <select id="city" name="city">
                                                    <option value="">请选择</option>
                                                </select>
                                                <select id="country" name="country">
                                                    <option value="">请选择</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="select-b-b">
                                            <div class="btn btn-important btn-w160x48 lh32 f16" onclick="savePrice()">确认</div>
                                        </div>
                                    </div>
                                    <div class="warrant-shop">
                                        <div class="head">
                                            <ul class="clearfix">
                                                <li class="w25">已授权商品</li>
                                                <li class="w10">批发价</li>
                                                <li class="w15">价格策略</li>
                                                <li class="w15">授权范围</li>
                                                <li class="w5">状态</li>
                                                <li class="w30">操作</li>
                                            </ul>
                                        </div>
                                        <div id="commTabs_2_body" class="body clearfix">

                                        </div>
                                        <div id="comm-paging" class="comm-paging" style="float: right;"></div>
                                    </div>
                                </div>
                                <div class="body-item"></div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- foot_nav -->
    <div id="foot_nav"></div>

    <div id="bottom_main"></div>
    <script type="text/template" id="item-template1">
        <%_.each(obj, function(item){%>
        <ul class="clearfix" data-id="<%=item.id%>">
            <li class="w25 shop-n"><%=item.policyname%></li>
            <li class="w10 trade-p"><%=item.context%></li>
            <li class="w15"><%=item.tradeprice%></li>
            <li class="w15"><%=item.price%></li>
            <li class="w5"><%=item.stock%></li>
            <li class="w30">
                <% if(item.status == "1"){ %>
                <a class="btn btn-warn btn-w70x32 ml20" id="editor" href='<%=item.edit_url%>'>编辑</a>
                <div class="btn btn-important btn-w70x32 zz">终止</div>
                <% } else { %>
                <div class="btn btn-important btn-w70x32 " style="visibility:hidden;">终止</div>
                <% }%>
            </li>
        </ul>
        <%});%>
    </script>
    <!-- 确认框 -->
    <script type="text/template" id="item-confirm">
        <div class="dialog-div">
            <div>您将对该采购商已授权的商品终止授权，你确认终止吗？</div>
            <div class="price-game-btn">
                <div class="btn btn-gray btn-w140x40 remove">取消</div>
                <div class="btn btn-warn btn-w140x40" id="tj">提交</div>
            </div>
        </div>
    </script>
    <!-- 错误信息框 -->
    <script type="text/template" id="item-error">
        <div class="dialog-div">
            <div>操作错误，请重新操作</div>
            <div class="price-game-btn">
                <div class="btn btn-warn btn-w140x40" id="ok" code="">确认</div>
            </div>
        </div>
    </script>
    <!-- 价格策略下拉框 -->
    <script type="text/template" id="price-option-templ">
        <option value="">请选择</option>
        <% _.each(obj, function(item){%>
        <option value="<%=item.code %>"><%=item.text %></option>
        <% }); %>
    </script>
    <!-- 省市区 -->
    <script type="text/template" id="addr-option-templ">
        <option value="">请选择</option>
        <% _.each(obj, function(item){%>
        <option value="<%=item.code %>"><%=item.text %></option>
        <% }); %>
    </script>
    <script type="text/javascript" src="/assets/b2b/js/libs/jquery.validate.min.js"></script>

    <script type="text/javascript" src="/assets/b2b/js/libs/dialog-min.js"></script>
    <script src="/assets/b2b/js/libs/jquery.paging.min.js"></script>
    <script src="/assets/b2b/js/pageModules/supplyer/S7.js"></script>
@stop